package net.esj.basic.core.engine.tools.formate;

import net.esj.basic.core.engine.tools.formate.string.DBCFormatter;
import net.esj.basic.core.engine.tools.formate.string.TrimFormatter;

//
public  class FormatterChain implements ExecuteChain {

	private FormatterChain nexyFormatterChain;
	
	private Formatter formatter;
	
	public FormatterChain(FormatterChain nexyFormatterChain, Formatter formatter) {
		super();
		this.nexyFormatterChain = nexyFormatterChain;
		this.formatter = formatter;
	}

	@Override
	public void doExecute(Object target) {
		if(formatter!=null){
			formatter.doExecute(nexyFormatterChain,target);
		}
	}

	public static final void main(String[] args){
		FormatterChain chain = new FormatterChain(new FormatterChain(null, new DBCFormatter()),new TrimFormatter());
		String str = "   nihaoｈｋ　｜　　　ｎｉｈｅｈｅ　，。　７８　　７　";
		chain.doExecute(str);
		System.out.println(str);
	}
}
